/*------------------------input初始化-----------------------------*/
$('.dataDirection').on('blur','input[type=number]',function(){
	if(!Boolean($(this).val().replace(/\s+/g, ""))){
		$(this).val(0);
	}
})
$('.doAudit').on('click',function(){
	$('.registerTipSubmit').attr('transferAuditId',$(this).attr('transferAuditId'));
	$('.registerTipSubmit').attr('status',$(this).attr('status'));
	$('.registerTipSubmit').attr('action','0');
	$('.registerTip').show();
	$('.registerTipBg').show();
	$('html,body').css('overflow','hidden');
})
/*隐藏提示*/
$(document).on('touchstart','.registerTipCancel',function(){
	$('.registerTip').hide();
	$('.registerTipBg').hide();
	$('html,body').css('overflow-y','scroll');
})
$(document).on('touchstart','.registerTipSubmit',function(){
	if(parseInt($(this).attr('action')) == 0){
		//审核
		var transferAuditId = $(this).attr('transferAuditId');
		var status = $(this).attr('status');
		$.ajax({
			type:"POST",
			url : "/weishang/supplier/modifyTransferAuditRecordStatus.json",
			dataType : "json",
			data : {
				"transferAuditId" :transferAuditId,
				"status":status
			},
			success : function(data) {
				$('.registerTip').hide();
				$('.registerTipBg').hide();
				$('html,body').css('overflow-y','scroll');
				$('.doAudit').addClass('noClick').removeClass('doAudit').html('已审核');
			}
		})
	}else if(parseInt($(this).attr('action')) == 1){
		//充值
		$('.registerTip').hide();
		$('.registerTipBg').hide();
		$('html,body').css('overflow-y','scroll');
		var bond = $('.bond').val();
		var balance = $('.balance').val();
		$('input[name=bond]').val(bond);
		$('input[name=balance]').val(balance);
		$('input[name=money]').val(balance-(-bond));
		$('form[name=postMessage]').submit();
		
		/*var transferAuditId = $(this).attr('transferAuditId');
		var bond = $('.bond').val();
		var balance = $('.balance').val();
		var level = $('.level').val();
		$.ajax({
			type:"POST",
			url : "/weishang/supplier/rechargeAction.json",
			dataType : "json",
			data : {
				"bond" :bond,
				"balance":balance,
				"transferAuditId":transferAuditId,
				"status":2,
				"level":level
			},
			success : function(data) {
				$('.registerTip').hide();
				$('.registerTipBg').hide();
				$('html,body').css('overflow-y','scroll');
				$('.doRecharge').addClass('noClick').removeClass('doRecharge').html('已充值');
			}
		})*/
		
	}else{
		//删除
		var transferAuditId = $(this).attr('transferAuditId');
		var status = $(this).attr('status');
		$.ajax({
			type:"POST",
			url : "/weishang/supplier/modifyTransferAuditRecordStatus.json",
			dataType : "json",
			data : {
				"transferAuditId" :transferAuditId,
				"status":status
			},
			success : function(data) {
				window.location.href="/weishang/supplier/transferRecordList.htm";
			}
		})
	}
	
})
$('.doRecharge').on('click',function(){
	$('.registerTipSubmit').attr('transferAuditId',$(this).attr('transferAuditId'));
	$('.registerTipSubmit').attr('status',$(this).attr('status'));
	$('.registerTipSubmit').attr('action','1');
	$('.registerTip').show();
	$('.registerTipBg').show();
	$('.registerTittle').html('确定充值吗？');
	$('html,body').css('overflow','hidden');
})


$('.deleteAudit').on('click',function(){
	$('.registerTipSubmit').attr('transferAuditId',$(this).attr('transferAuditId'));
	$('.registerTipSubmit').attr('status',$(this).attr('status'));
	$('.registerTipSubmit').attr('action','2');
	$('.registerTip').show();
	$('.registerTipBg').show();
	$('.registerTittle').html('确定删除吗？');
	$('html,body').css('overflow','hidden');
})